// https://leetcode.cn/problems/student-attendance-record-i/
// Created by ade on 2022/8/9.
//
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    // a缺少2次
    // l 连续的次数不能超过3次
    bool checkRecord(string s) {
        int a = 0;
        int flag = 1;
        int l = 0;
        for (int i = 0; i < s.size(); i++) {
            if (s[i] == 'A') {
                flag = 0;
                a++;
            }
            if (a > 1) return false;
            if (flag == 0) {
                if (s[i] == 'L') {
                    flag = 1;
                    l++;
                    if (l > 2) return false;
                } else {
                    flag = 0;
                    l = 0;
                }
            } else {
                if (s[i] == 'L') {
                    l++;
                    if (l > 2) return false;
                } else {
                    flag = 0;
                    l = 0;
                }
            }
        }
        return true;
    }
};

int main() {
    Solution so;
    string h1 = "PPALLP";
    auto res = so.checkRecord(h1);
    if (res) cout << "yes" << endl;
    else cout << "no" << endl;
    return 0;
}